<template>
  <div class="page draw">
    <div class="point">
      <img
        class="element"
        src="../assets/img/drawElement.png"
        alt=""
      >
      <p>您当前的积分为<br><span>{{point}}</span>分!!</p>
    </div>
    <div class="opter">
      <div class="drawBtn">
        <img
          @click="draw(200)"
          src="../assets/img/draw200.png"
          alt=""
        >
        <img
          @click="draw(500)"
          src="../assets/img/draw500.png"
          alt=""
        >
      </div>
      <div class="linkBtn">
        <img
          src="../assets/img/drawCash.png"
          alt=""
        >
        <img
          @click="backHome"
          src="../assets/img/backHomeDraw.png"
          alt=""
        >
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'draw',
  props: [
    'hasShow'
  ],
  data () {
    return {
      point: 1000,
      layerText: ''
    }
  },
  methods: {
    draw (type) {
      if (this.point < type) {
        this.$toast('积分不够');
      } else {
        this.point -= type;
      }
    },
    backHome () {
      this.$router.replace({ name: 'home' });
    }
  }
}
</script>

<style lang="less" scoped>
.draw {
  padding: 0;
  background: url("../assets/img/drawBg.png") center center no-repeat;
  background-size: cover;
}
.point {
  top: 10%;
  width: 100%;
  height: 4.21rem;
  img {
    position: relative;
    width: 4.22rem;
    height: 100%;
  }
  p {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    line-height: 0.8rem;
    text-align: center;
    font-size: 0.66rem;
    font-weight: bold;
    color: #000000;
    span {
      margin-top: -0.1rem;
      margin-right: 0.05rem;
      vertical-align: middle;
      display: inline-block;
      font-size: 0.8rem;
    }
  }
}
.opter {
  top: 65%;
  bottom: 0;
  width: 100%;
  .drawBtn {
    margin-bottom: 5%;
    img {
      width: 2.98rem;
      height: 1rem;
    }
    img:nth-child(1) {
      margin-bottom: 0.25rem;
    }
  }
  .linkBtn {
    width: 100%;
    display: flex;
    flex-direction: row;
    img {
      margin: inherit;
    }
    img:nth-child(1) {
      margin-left: 0.9rem;
      margin-right: 0.3rem;
      width: 3.26rem;
      height: 0.73rem;
    }
    img:nth-child(2) {
      width: 2.27rem;
      height: 0.76rem;
    }
  }
}
</style>